GrapeCity CalendarGrid for Windows Forms 2.0J
Item(IEnumerable<DateTime>) プロパティ
使用例 

CalendarTable の日付を示す System.DateTime 値のコレクション。DateRange によって日付コレクションを作成できます。
指定した日付の CalendarTable を取得します。これらの日付のセルの値またはスタイルを一度に変更できます。このテーブルのセルの値とスタイルは、Template 内の CalendarTemplate.Content から継承されます。
構文
Public Overloads ReadOnly Property Item( _
   ByVal dates As IEnumerable(Of Date) _
) As CalendarTable
public CalendarTable Item( 
   IEnumerable<DateTime> dates
) {get;}

パラメータ

dates
CalendarTable の日付を示す System.DateTime 値のコレクション。DateRange によって日付コレクションを作成できます。

プロパティ値

指定した日付のテーブルを示す CalendarTable オブジェクト。
使用例
次のサンプルコードは、CalendarTable にアクセスする方法を示します。
private void SetValue()
{
    // Use name to access the cell.
    this.gcCalendarGrid1.Template.Content[2, 0].Name = "cell1";

    // Set value to a cell in today.
    this.gcCalendarGrid1[DateTime.Today][1, 0].Value = "abc";
    this.gcCalendarGrid1[DateTime.Today]["cell1"].Value = "abc";

    // Set value to the cells in a date range.
    IEnumerable<DateTime> dateRange = DateRange.CreateDateRange(new DateTime(2014, 2, 1), new DateTime(2014, 2, 20));
    this.gcCalendarGrid1[dateRange][1, 0].Value = "abc";
    this.gcCalendarGrid1[dateRange]["cell1"].Value = "abc";

    // Set value to the cells in a yearly recurrence.
    IEnumerable<DateTime> yearlyDate = DateRange.CreateYearlyDayRecurrence(new DateTime(2000, 2, 1), 1, 100);
    this.gcCalendarGrid1[yearlyDate][1, 0].Value = "abc";
    this.gcCalendarGrid1[yearlyDate]["cell1"].Value = "abc";

    // Set value to the cells in a monthly weekday recurrence.
    IEnumerable<DateTime> monthlyWeekday = DateRange.CreateMonthlyWeekDayRecurrence(new DateTime(2014, 1, 1), DayOfWeekInMonth.Last, DayOfWeek.Friday, 1, new DateTime(2014, 12, 31));
    this.gcCalendarGrid1[monthlyWeekday][1, 0].Value = "abc";
    this.gcCalendarGrid1[monthlyWeekday]["cell1"].Value = "abc";

    // Set value to many cells. By the SetValue method, we can get better performance.
    for (int row = 0; row < this.gcCalendarGrid1.Template.RowCount; row++)
    {
        for (int column = 0; column < this.gcCalendarGrid1.Template.ColumnCount; column++)
        {
            this.gcCalendarGrid1.SetValue(DateTime.Today, row, column, "abc");
        }
    }

    // Clear the values and formats set to a date, to release the memory.
    this.gcCalendarGrid1.Clear(DateTime.Today);

    // Clear all the values and formats, to release the memory.
    this.gcCalendarGrid1.ClearAll();
}
Private Sub SetValue()
    ' Use name to access the cell.
    Me.gcCalendarGrid1.Template.Content(2, 0).Name = "cell1"

    ' Set value to a cell in today.
    Me.gcCalendarGrid1(DateTime.Today)(1, 0).Value = "abc"
    Me.gcCalendarGrid1(DateTime.Today)("cell1").Value = "abc"

    ' Set value to the cells in a date range.
    Dim dateRange__1 As IEnumerable(Of DateTime) = DateRange.CreateDateRange(New DateTime(2014, 2, 1), New DateTime(2014, 2, 20))
    Me.gcCalendarGrid1(dateRange__1)(1, 0).Value = "abc"
    Me.gcCalendarGrid1(dateRange__1)("cell1").Value = "abc"

    ' Set value to the cells in a yearly recurrence.
    Dim yearlyDate As IEnumerable(Of DateTime) = DateRange.CreateYearlyDayRecurrence(New DateTime(2000, 2, 1), 1, 100)
    Me.gcCalendarGrid1(yearlyDate)(1, 0).Value = "abc"
    Me.gcCalendarGrid1(yearlyDate)("cell1").Value = "abc"

    ' Set value to the cells in a monthly weekday recurrence.
    Dim monthlyWeekday As IEnumerable(Of DateTime) = DateRange.CreateMonthlyWeekDayRecurrence(New DateTime(2014, 1, 1), DayOfWeekInMonth.Last, DayOfWeek.Friday, 1, New DateTime(2014, 12, 31))
    Me.gcCalendarGrid1(monthlyWeekday)(1, 0).Value = "abc"
    Me.gcCalendarGrid1(monthlyWeekday)("cell1").Value = "abc"

    ' Set value to many cells. By the SetValue method, we can get better performance.
    For row As Integer = 0 To Me.gcCalendarGrid1.Template.RowCount - 1
        For column As Integer = 0 To Me.gcCalendarGrid1.Template.ColumnCount - 1
            Me.gcCalendarGrid1.SetValue(DateTime.Today, row, column, "abc")
        Next
    Next

    ' Clear the values and formats set to a date, to release the memory.
    Me.gcCalendarGrid1.Clear(DateTime.Today)

    ' Clear all the values and formats, to release the memory.
    Me.gcCalendarGrid1.ClearAll()
End Sub
参照

GcCalendarGrid クラス
GcCalendarGrid メンバ
オーバーロード一覧

 

 


c 2008 GrapeCity inc. All rights reserved.